#ifndef _REDIS_REDIS_CONTEXT_POOL_H_
#define _REDIS_REDIS_CONTEXT_POOL_H_

#include <hiredis/hiredis.h>

#include "base/object_pool.h"

using namespace std;
using namespace base;

class RedisLocator;

class RedisContextPool : public ObjectPool<redisContext> {
 public:
  RedisContextPool(RedisLocator * locator) : ObjectPool<redisContext>(0, 20, 0, 100), locator_(locator) {
  }
  virtual ~RedisContextPool();
 protected:
  virtual redisContext * Create(const std::string & key);
  virtual void Destroy(redisContext * context);
 private:
  RedisLocator * locator_;
};

#endif // _REDIS_REDIS_CONTEXT_POOL_H_

